Working in PHP but not in tags

Search
Other Pre-Sale questions
Forum

Working in PHP but not in {source} tags

Derek F's Avatar Derek F
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Fetch all rows from the table
$sql = "SELECT ID, source, name, tier, obj_desc FROM sellOBJs";
$result = $conn->query($sql);

// Close the database connection
$conn->close();
?>

<!DOCTYPE html>
<html>
<head>
    <title>Dropdown from Database</title>
</head>
<body>
    <form>
        <label for="sellObj">Select an option:</label>
        <select name="sellObj" id="sellObj">
            <?php
            if ($result->num_rows > 0) {
                while ($row = $result->fetch_assoc()) {
                    $optionText = "{$row["ID"]} - {$row["source"]} - {$row["name"]} - {$row["tier"]} - {$row["obj_desc"]}";
                    echo "<option value='{$row["ID"]}'>$optionText</option>";
                }
            } else {
                echo '<option value="-1">No options available</option>';
            }
            ?>
        </select>
    </form>
</body>
</html>

YIELDS:

https://imgur.com/a/tymaoYB


When I copy the iteration into the module between the {source} tags:
(formPHP.php has all my connection stuff in it)
{source}
<?php
 include JPATH_SITE . '/PHP/extraPHP.php'; 
 include JPATH_SITE . '/PHP/formPHP.php';   
?>
{/source}

<form action="submit.php" method="post">
        <label for="league"> League:</label>
        <select id="league" name="league">          
<option value="LSCT">{source php="/PHP/extraPHP.php"}<?php echo $leagueName; ?>{/source} SCT</option>
<option value="LHCT">{source php="/PHP/extraPHP.php"}<?php echo $leagueName; ?>{/source} HCT</option>
<option value="Standard">Standard</option>
        </select><br><br>
        <label for="sellObj">Select an option:</label>
        <select name="sellObj" id="sellObj">
{source php="/PHP/formPHP.php"}<?php
            if ($result->num_rows > 0) {
                while ($row = $result->fetch_assoc()) {
                    $optionText = "{$row["ID"]} - {$row["source"]} - {$row["name"]} - {$row["tier"]} - {$row["obj_desc"]}";
                    echo "<option value='{$row["ID"]}'>$optionText</option>";
                }
            } else {
                echo '<option value="-1">No options available</option>';
            }
            ?>
{/source}
        </select>

        <label for="price">Price:</label>
        <input type="number" id="price" name="price" required><br><br>

        <label for="quantity">Quantity:</label>
        <input type="number" id="quantity" name="quantity" required><br><br>

        <label for="sellIGN">IGN:</label>
        <input type="text" id="sellIGN" name="sellIGN" required><br><br>

        <input type="submit" value="Submit">
    </form>

I Get this:

https://imgur.com/a/PQBjvPo

I saw something in the docs / troubleshooting about tags being stripped, but not sure that's what's happening here... tried [[ ]] etc. no help.
Hoping it's something easy I'm missing. Any Suggestions?
Thanks!
You can only post on this forum if you log in